<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 21.01.14
 * Time: 21:36
 */

class Tourism_Form_Admin_Background extends Engine_Form
{
  public function init()
  {
    $this
      ->setAttrib('class', 'global_form')
      ->setTitle('Create new background image')
      ->setDescription('Image to background changer');

    $this->addElement('Text', 'title', array(
      'label' => 'Title',
      'allowEmpty' => false,
      'placeholder' => 'Image Title',
      'required' => true,
      'validators' => array(
        array('NotEmpty', true),
        array('StringLength', false, array(1, 64)),
      ),
      'filters' => array(
        'StripTags',
        new Engine_Filter_Censor(),
      ),
    ));

    $this->addElement('File', 'photo', array(
      'label' => 'Photo',
      'destination' => APPLICATION_PATH.'/public/temporary/',
      'multiFile' => 1,
      'validators' => array(
        array('Count', false, 1),
        array('Extension', false, 'jpg,jpeg,png,gif'),
      )
    ));

    // Buttons
    $this->addElement('Button', 'submit', array(
      'label' => 'Save Changes',
      'type' => 'submit',
      'ignore' => true,
      'decorators' => array('ViewHelper')
    ));
  }
}
